<template>
  <div>
    <Myheader
      title="购物车案例2"
      backgroundColor="red"
      color="black"
    ></Myheader>
    <div class="main">
      <Mygoods v-for="obj in list" :key="obj.id" :obj="obj"></Mygoods>
    </div>
    <Myfooter :arr="list"></Myfooter>
  </div>
</template>

<script>
import Myheader from "./components/Myheader";
import Mygoods from "./components/Mygoods";
import Myfooter from "./components/Myfooter";
export default {
  data() {
    return {
      list: [],
    };
  },
  components: {
    Myheader,
    Mygoods,
    Myfooter,
  },
  created() {
    this.$axios({
      url: "https://www.escook.cn/api/cart",
    }).then((res) => (this.list = res.data.list));
  },
};
</script>

<style scoped>
.main {
  padding: 50px 0 50px 0;
}
</style>